# docker build -t fc6a1b03/alpinelinux-nginx:http3.2022.01.03 .
FROM alpine:latest
MAINTAINER xuhaifeng <asd1161575755@outlook.com>

WORKDIR /data/

# 声明端口
EXPOSE 80/tcp
EXPOSE 443/tcp
EXPOSE 443/udp

COPY nginx /data/nginx
# 补充运行库
COPY libz.so.1.2.11 /usr/glibc-compat/lib/libz.so.1.2.11
COPY libcrypt.so.1.1.0 /usr/glibc-compat/lib/libcrypt.so.1.1.0
COPY libpcre2-8.so.0.7.1 /usr/glibc-compat/lib/libpcre2-8.so.0.7.1

# 时区配置
ENV    TIME_ZONE Asiz/Shanghai
VOLUME /etc/localtime:/etc/localtime

# 更新系统
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk -U --no-cache upgrade
# 安装glibc
RUN apk add -U --no-cache ca-certificates wget
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN wget -P /data https://github.com.cnpmjs.org/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-2.34-r0.apk
RUN apk add --no-cache /data/glibc-2.34-r0.apk
# 补充运行库
RUN ln -s /usr/glibc-compat/lib/libz.so.1.2.11 /usr/glibc-compat/lib/libz.so.1
RUN ln -s /usr/glibc-compat/lib/libpcre2-8.so.0.7.1 /usr/glibc-compat/lib/libpcre2-8.so.0
RUN rm -rf /usr/glibc-compat/lib/libcrypt.so.1 && ln -s /usr/glibc-compat/lib/libcrypt.so.1.1.0 /usr/glibc-compat/lib/libcrypt.so.1
# 配置nginx
RUN chmod a+x /data/nginx/sbin/nginx
RUN ln -s /data/nginx/sbin/nginx /usr/bin/nginx
RUN ln -s /data/nginx/sbin/nginx /usr/local/bin/nginx
RUN nginx -V
# RUN nginx -t